Skip to content

gh-148468: Accept string-like help proxies in argparse#150276

Open
RaghunandanKumar wants to merge 1 commit into
python:mainfrom
RaghunandanKumar:fix-argparse-string-like-help
Open

gh-148468: Accept string-like help proxies in argparse#150276
RaghunandanKumar wants to merge 1 commit into
python:mainfrom
RaghunandanKumar:fix-argparse-string-like-help

Conversation

@RaghunandanKumar
Copy link
Copy Markdown

Summary

  • restore support for string-like proxy objects in colorized argparse descriptions, epilogs, and argument help text
  • normalize formatter text at the string-formatting boundary instead of assuming concrete str objects
  • add regression coverage for proxied descriptions, epilogs, and interpolated help text

Issue

Testing

  • ./python.exe -m test test_argparse
  • runtime repro with a minimal LazyStr proxy and parser.format_help()

Copy link
Copy Markdown
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! As mentioned in my comment on the issue, the str() coercion can go at the re.sub call site rather than at the top of _expand_help. Also, please scope the change down. The _format_action changes and the broader test expansion aren't necessary for this fix.

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 23, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@savannahostrowski savannahostrowski added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants